package xjutils

import (
	"errors"
	"github.com/gin-gonic/gin"
)

func GetBearerToken(ctx *gin.Context) (string, error) {
	Authorization := ctx.GetHeader("Authorization")
	if len(Authorization) < 8 {
		err := errors.New("Authorization fail.")
		return "", err
	}
	AccessToke := Authorization[7:]
	return AccessToke, nil
}
